﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="info.aspx.cs" Inherits="Our.Umbraco.uDbCompare.info" MasterPageFile="~/umbraco/masterpages/umbracoPage.Master" Title="uDBCompare" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.controls" Assembly="umbraco" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/MacroInUse.ascx" TagName="MacroInUse" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/TemplateInUse.ascx" TagName="TemplateInUse" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/DocTypeInUse.ascx" TagName="DocTypeInUse" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/LegacyAlias.ascx" TagName="LegacyAlias" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/HiddenTabs.ascx" TagName="HiddenTabs" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/TrailingSpace.ascx" TagName="TrailingSpace" %>
<%@ Register TagPrefix="uDbCompare" Src="~/umbraco/plugins/uDbCompare/OrphanedDocTemplate.ascx" TagName="OrphanedDocTemplates" %>

<asp:Content ID="cphHead" ContentPlaceHolderID="head" runat="server">
    <link href="../../../umbraco_client/propertypane/style.css" rel="stylesheet" />
</asp:Content>

<asp:Content ID="cphBody" ContentPlaceHolderID="body" runat="server">
    <cc1:TabView ID="TabViewDetails" runat="server" Width="552px" Height="692px" />

    <asp:Panel ID="InfoPanel" runat="server">
        <div class="propertypane">
            <div>
                <div class="propertyItem">
                    <div class="dashboardWrapper">
                        <h2>uDbCompare</h2>
                        <img src="images/database.png" alt="Export" class="dashboardIcon" />

                        <h3>
                            Please note that while results returned in uDbCompare ared believed to be correct, this is a very new package
                            and has not been throughly tested.
                        </h3>
                        <p>
                            uDbCompare compares various items (Doc Types, Media Types, Templates, Data Types, Relationships, Dictionary Items, & Macros) in the current Umbraco database to a remote database.                      
                        </p>
                        <p>
                            To use, just right click on DB Compare and Create.  One node per database you want to compare to.  Then go under the settings
                            tab and type in the connection string.  As the connection string is stored in plain text in the database, its highly
                            recommended to use {0} for username and {1} for password.  Username & Password can then be cached in the session state.
                        </p>
                        <p>
                            uDbCompare also has utilities to help you find where some of your items are used, to help with cleanup of the system.
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>

    <asp:Panel ID="LocalPanel" runat="server">
        <div class="propertypane">
            <div>
                <div class="propertyItem">
                    <div class="dashboardWrapper">
                        <h2>Sync Templates</h2>
                        <img src="images/database.png" alt="Export" class="dashboardIcon" />
                        <h3>WARNING: Please have a backup of our /masterpages folder before running!!!</h3>
                        <p>
                            Experimental attempt to update the cmsTemplate table with actual template code from the files.<br />
                            This is probably only of particular use if you have the masterpages under source control and are constantly
                            overwriting your masterpages via the file system.
                        </p>
                        <p>
                            <asp:Button ID="SyncTemplateButton" runat="server" Text="Sync Templates" OnClick="SyncTemplateButton_OnClick" OnClientClick="javascript:return confirm('This may alter your /masterpages folder - Please backup before running!  Continue?');" />
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <div class="propertypane">
            <div>
                <div class="propertyItem">
                    <div class="dashboardWrapper">
                        <h2>Find Orphaned/Out of Sync Templates</h2>
                        <img src="images/database.png" alt="Export" class="dashboardIcon" />
                        <p>
                            Performs three checks:
                            <ul>
                                <li>Look on the file system for any masterpages that are not in the umbraco db</li>
                                <li>Verify that the template in the umbraco db matches the code in the masterpage file</li>
                                <li>Verify that the masterpagefile in the template file is set to the corrent parent in the umbraco db</li>
                            </ul>
                        </p>
                        <p>
                            <asp:Button ID="OrphanTemplateButton" runat="server" Text="Search Templates" OnClick="OrphanTemplateButton_OnClick"  />
                        </p>
                        <p>
                            <asp:GridView ID="OrphanTemplateGridView" runat="server" OnRowDataBound="OrphanTemplateGridView_OnRowDataBound"></asp:GridView>
                            <asp:Label ID="NoOrphanResultsLabel" runat="server" Visible="false" Text="All Templates are in sync"></asp:Label>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <div class="propertypane">
            <div>
                <div class="propertyItem">
                    <div class="dashboardWrapper">
                        <h2>XSLT Files in Use</h2>
                        <img src="images/database.png" alt="Export" class="dashboardIcon" />
                        <p>
                            As this reads the local filesystem, it can only be done locally.
                        </p>
                        <p>
                            <asp:DropDownList ID="xsltFiles" runat="server"></asp:DropDownList>
                            <asp:Button ID="XsltSearchButton" runat="server" Text="Search for Macro" OnClick="XsltSearchButton_OnClick" />
                            <asp:Button ID="XsltSearchAllButton" runat="server" Text="Show All" OnClick="XsltSearchAllButton_OnClick" />
                        </p>
                        <p>
                            <asp:GridView ID="XsltGridView" runat="server"></asp:GridView>
                            <asp:Label ID="XsltNoResultsLabel" runat="server" Visible="false" Text="Xslt file is not referenced by any macros"></asp:Label>
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <div class="propertypane">
            <div>
                <div class="propertyItem">
                    <div class="dashboardWrapper">
                        <h2>ASCX Files in Use</h2>
                        <img src="images/database.png" alt="Export" class="dashboardIcon" />
                        <p>
                            As this reads the local filesystem, it can only be done locally.
                        </p>
                        <p>
                            <asp:DropDownList ID="ascxFiles" runat="server"></asp:DropDownList>
                            <asp:Button ID="AscxSearchButton" runat="server" Text="Search for Macro" OnClick="AscxSearchButton_OnClick" />
                            <asp:Button ID="AscxSearchAllButton" runat="server" Text="Show All" OnClick="AscxSearchAllButton_OnClick" />
                        </p>
                        <p>
                            <asp:GridView ID="AscxGridView" runat="server"></asp:GridView>
                            <asp:Label ID="AscxNoResultsLabel" runat="server" Visible="false" Text="Ascx file is not referenced by any macros"></asp:Label>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>

    <asp:Panel ID="InUsePanel" runat="server">
        <uDbCompare:MacroInUse id="MacroInUse1" runat="server" />
        <uDbCompare:TemplateInUse id="TemplateInUse1" runat="server" />
        <uDbCompare:DocTypeInUse id="DocTypeInUse1" runat="server" />
        <uDbCompare:LegacyAlias id="LegacyAlias1" runat="server" />
        <uDbCompare:HiddenTabs ID="HiddenTabs1" runat="server" />
        <uDbCompare:TrailingSpace ID="TrailingSpace1" runat="server" />
        <uDbCompare:OrphanedDocTemplates ID="OrphanedDocTemplates1" runat="server" />
    </asp:Panel>
</asp:Content>